<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html >
<html lang="en">
<head>
<%@include file="../../common/includeBaseSet.jsp" %>
<%@include file="../../common/includeSystemSet.jsp" %>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp" %>
<style type="text/css">
	a{cursor:pointer}
    .table.table-bordered thead tr th {
        vertical-align:middle;
        white-space:nowrap;
        min-width:100px;

    }
</style>
</head>
<body onload="getSubsrribeInfoList()">
    <div class="page-content" style="overflow-x:scroll;">
        <form id="baseForm" class="form-horizontal">
            <input type='hidden' class='pageNum' name='pageNum' value='1'/>
            <input type='hidden' class='pageSize' name='pageSize' value='10'/>
	        <div class="col-xs-12 panel panel-default">
	        	<div style="margin-top:1%">
		            <div class="col-xs-2" style="width: 27%">
		            	<div class="form-group">
		                    <label class="col-xs-5 control-label">组团:</label>
		                    <div class="col-xs-7">
                                <select name="premisesId" id="premisesId" class="form-control" style="width:100%" >
                                    <c:choose>

                                        <c:when test="${premisesList != null && premisesList != ''}">
                                            <option value="">--全部--</option>
                                            <c:forEach items="${premisesList}" var="list">
                                                <option value="${list.id}">${list.groupName}</option>

                                            </c:forEach>
                                        </c:when>
                                    </c:choose>
                                </select>
                               <%-- <input class="form-control" type="text" name="premisesSecName" id="premisesSecName" />--%>
		                    </div>
		                </div>
		            </div>
		            <div class="col-xs-8" style="display: flex;flex-wrap: wrap;">
                        <div class="form-group" style="position:relative">
                            <label class="col-xs-3 control-label">认购时间:</label>
                            <div class="col-xs-4">
                                <input class="form-control" type="text" name="strTime" id="strTime" onClick="WdatePicker()"/>
                            </div>
                            <div class="col-xs-4">
                                <input class="form-control" type="text" name="endTime" id="endTime" onClick="WdatePicker()"/>
                            </div>
                            <div style="position: absolute;top: 19%;left: 58%;">-</div>
                        </div>
		                <div class="form-group" style="display: flex;flex-direction: row;">
		                    <div style="margin-left:40px">
		                        <button id='searchBtn' class="btn btn-warning  btn-xs"  style="width:70px;"
		                            title="查询" type="button" onclick="JY.Page.jump('baseForm',1,'getSubsrribeInfoList')">
		                            <i class="icon-search bigger-110 icon-only">搜索</i>
		                        </button>
		                    </div>

                            <div style="margin-left:40px">
                                <button id='exportBtn' class="btn btn-info  btn-xs"  style="width:70px;background: blue"
                                        title="导出" type="button" onclick="exportCustomerInfo()">
                                    <i class=" bigger-110 icon-only">导出</i>
                                </button>
                            </div>

                            <div style="margin-left:40px">
                                <button id='cleanBtn' class="btn btn-info  btn-xs"  style="width:70px;background: blue"
                                        title="清空" type="button" onclick="cleanQuery()">
                                    <i class=" bigger-110 icon-only">清空</i>
                                </button>
                            </div>
		                </div>

	            </div>
	        </div>
	    </form>
        <div class="col-xs-12">
            <table id="baseTable" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">订房日期</th>
                        <th class="center" style="min-width:250px;">房间</th>
                        <th class="center">状态</th>
                        <th class="center">类型</th>
                        <th class="center">编号</th>
                        <th class="center">签署日期</th>
                        <th class="center">客户姓名</th>
                        <th class="center" style="min-width:150px;">证件号码</th>
                        <th class="center">媒体子类</th>
                        <th class="center">联系电话</th>
                        <th class="center">首次来访日期</th>
                        <th class="center" style="min-width:250px;">联系地址</th>
                        <th class="center">成交面积</th>
                        <th class="center">标准单价</th>
                        <th class="center">标准总价</th>
                        <th class="center">成交单价</th>
                        <th class="center">成交总价</th>
                        <th class="center">付款方式</th>
                       <%-- <th class="center">按揭金额</th>--%>
                        <th class="center">最终折扣</th>
                        <th class="center" style="min-width:250px;">折扣说明</th>
                        <th class="center">已交金额</th>
                        <th class="center">置业顾问</th>
                        <%--<th class="center">底价建筑单价</th>
                        <th class="center">底价总价</th>--%>
                    </tr>
                </thead>
                <tbody><!-- 内容 --></tbody>
            </table>
            <div class="row">
                <div class="col-sm-8">
                    <!--设置分页位置-->
                    <div id="pageing" class="dataTables_paginate paging_bootstrap">
                        <ul class="pagination"></ul>
                    </div>
                </div>
            </div>
        </div>
        <!-- #dialog-confirm -->
        <%@include file="../../common/dialog.jsp"%>
    </div>
</body>
<script type="text/javascript">

	//查询列表
	function getSubsrribeInfoList(){
		var loadIndex = layer.load(1, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });
		JY.Ajax.doRequest("baseForm",jypath +'/customer/subscribe/subscribeInfoList',null,function(data){
            $("#baseTable tbody").empty();
            var page = data.obj;
            //分页数据
            var pageNum = page.pageNumber, pageSize = page.pageSize, totalRecord = page.total;
            var html = "";
            var results = page.rows;
            if(results == null || results.length <= 0){
            	html+="<tr><td colspan='8' class='center'>没有相关数据</td></tr>";
                $("#baseTable tbody").append(html);
                $("#pageing ul").empty();//清空分页
                layer.closeAll('loading');
                return false;
            }
          
            var leng=(pageNum-1)*pageSize;//计算序号
            for(var i = 0;i<results.length;i++){
                var info = results[i];
                var content;
                if(info.content){
                    content = info.content;
                }else{
                    content = '';
                }
                html += "<tr>";
                html += "<td class='center'>" + info.didTimeStr + "</td>";
                html += "<td class='center'>" + info.combinedName + "</td>";
                html += "<td class='center'>" + info.customerStatus + "</td>";
                html += "<td class='center'>" + info.codeName + "</td>";
                html += "<td class='center'>" + info.signCode + "</td>";
                html += "<td class='center'>" + JY.Date.Format(info.signDateStr, "yyyy-MM-dd") + "</td>";
                html += "<td class='center'>" + info.customerName + "</td>";
                html += "<td class='center'>" + info.peDocumentNumber + "</td>";
                html += "<td class='center'>" + info.codeValue + "</td>";//客户来源
                html += "<td class='center'>" + info.customerPhone + "</td>";
                html += "<td class='center'>" + info.ftContactTimeStr + "</td>";//首次来访日期
                html += "<td class='center'>" + info.peContactAddress + "</td>";
                html += "<td class='center'>" + info.calculateArea + "</td>";
                html += "<td class='center'>" + info.conversionPrice + "</td>";
                html += "<td class='center'>" + info.lumpsumPrice + "</td>";
                html += "<td class='center'>" + info.subscribePrice + "</td>";
                html += "<td class='center'>" + info.subscribeAmount + "</td>";
                html += "<td class='center'>" + info.paymentMethod + "</td>";
               /* html += "<td class='center'>" + info.paymentMethod + "</td>";*///按揭金额
                html += "<td class='center'>" + info.discountAmount + "</td>";
                html += "<td class='center'>" + info.discountNote + "</td>";
                html += "<td class='center'>" + info.payDepositMoney + "</td>";//已收金额
                html += "<td class='center'>" + info.userName + "</td>";
                html += "</tr>";
            }
            $("#baseTable tbody").append(html);
            JY.Page.setPage("baseForm","pageing",pageSize,pageNum,totalRecord,"getSubsrribeInfoList");
            layer.closeAll('loading');
		});
	}



    //导出列表
    function exportCustomerInfo(){
        var premisesId = $("#premisesId").val();
        var strTime = $("#strTime").val();
        var endTime = $("#endTime").val();
        location.href = '${jypath}/customer/subscribe/exportSubscribeInfoList?premisesId='+premisesId+'&strTime='+strTime+'&endTime='+endTime
    }

    function cleanQuery(){
	    $("#premisesId").val("");
        $("#strTime").val("");
        $("#endTime").val("");
    }
</script>
</html>